export function formatCurrency(amount, options = { decimal: 2, locale: 'en-US' }) {
  if (isNaN(amount)) {
    throw new Error('Input must be a valid number')
  }
  const { decimal, locale } = options
  return Number(amount).toLocaleString(locale, {
    minimumFractionDigits: decimal,
    maximumFractionDigits: decimal
  })
}

